<%= stylesheet_link_tag "basic_info" %>
<%= javascript_include_tag "users" %>
<div id="notice" class="notice"><%= notice %></div>
  <!--搜索， 功能菜单-->
<div class="middle" style="padding-top: 10px;">
  <% if sys_admin? or biz_unit_admin? %>
      <div class="search-row ">
        <label>帐号</label>
        <input id="login_name" type="text"/>
        <% if sys_admin? %>
        <label>角色</label>
        <%= select "user", :role_id, Role.all.collect { |role| [role.name, role.id] }, {:include_blank => true} %>
            <% end %>
        <a class="inline-block s-btn" onclick="search_user();" href="#"><%= t 'common.search' %></a>

      </div>
      <div class="search-btn-div"> <%= link_to (t 'common.new'), new_user_path, {:class => "inline-block s-btn"} %></div>
  <% end %>
  <!--显示列表-->
  <table class="grid">
    <tr>
      <th>帐号</th>
      <th>邮箱</th>
      <th>角色</th>
      <th>备注</th>
      <th>操作</th>
    </tr>
    <% @users.each do |user| %>
        <tr id="user_<%= user.id %>">
          <td><%= user.login %></td>
          <td><%= user.email %></td>
          <td><%= user.role.name %></td>
          <td><%= user.comment %></td>
          <td style="width: 150px;">
            <%= link_to (t 'common.show'), user %>

            <%= link_to (t 'common.edit'), edit_user_path(user) %>

            <%= link_to (t 'common.destroy'), user, confirm: (t 'common.confirm_destroy'), method: :delete %>

          </td>
        </tr>
    <% end %>
  </table>
  <% session[:max_page] = @users.total_pages %>
  <%= will_paginate @users, :style => 'font-size: small' %>
</div>